package dynamic_hybrid;

import java.io.BufferedWriter;
import java.io.FileWriter;



public class MatrixTest {
	
	public static void main(String[] argv)
	  {

	      try
	      {
	          
	          int     RULE1VALUE = 45,RULE2VALUE=95 ;
	          int[][] RULEMATRIX1,RULEMATRIX2,HYBRIDMATRIX,RESULTVECTOR ;
	          
	          
	          
	          int row = 0 , column = 0 , blockrow = 5, blockcolumn = 5 ; 
	          
	          row = column = 25 ; 
	          
	          RuleMatrix ruleMatrix1 , ruleMatrix2 ;
	          CalculateResultVector resultVector   ;
	          HybridMatrix hybridMatrix            ;
	          Statistics statistics  ;
	          
	          String file = "out_dynamics2.txt" ;
	          FileWriter      fwriter    = new FileWriter(file);
	          BufferedWriter  yaz        = new BufferedWriter(fwriter);
	        
	      	
		     // ruleMatrix1.toString()  ;
		     // ruleMatrix2.toString()  ;		      
		     // hybridMatrix.toString() ;      	  
	      	 // resultVector.toString() ;	      	  
	      	 //  statistics.toString()  ;	          
	          
	      //    for(int i = 2 ; i<512;i++)
	        //  {
	        	 /* for(int j = i+1 ;j<50 ; j++ )
	        	  {*/
	        		  
	        		  
	        		  int i=511;
	        		  int j=308;
	        		  RULE1VALUE = i;
	        		  RULE2VALUE = j;
	        				  
	        		  ruleMatrix1 = new RuleMatrix(RULE1VALUE, row, column, blockrow, blockcolumn) ;
	        		  ruleMatrix2 = new RuleMatrix(RULE2VALUE, row, column, blockrow, blockcolumn) ;
	        		  RULEMATRIX1 = ruleMatrix1.getRuleMatrix() ; 
	    		      RULEMATRIX2 = ruleMatrix2.getRuleMatrix() ;
	    		      
	    		      hybridMatrix = new HybridMatrix(RULEMATRIX1,RULEMATRIX2) ;
	    		      HYBRIDMATRIX = hybridMatrix.getHybridMatrix() ;
	    		      statistics = new Statistics(file,yaz) ;
	    		      resultVector =  new CalculateResultVector() ;
	    		      for(int k = 0 ; k<100 ; k++)
	    		      {	    		    	  
	    		    	  RESULTVECTOR = resultVector.getResultVector(512,HYBRIDMATRIX) ;
	    		    	  statistics.checkPassOrFail(RESULTVECTOR)          ;
	    		      }
	    		      statistics.writePassedResults(RULE1VALUE, RULE2VALUE,0) ;
	        	//  } 	
	      //    }           
	          yaz.close();	          
	      }catch (Exception e)
	    {
	        System.err.println("Error: " + e.getMessage());
	    }
	  }	
}
